package com.molichuxing.job;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.molichuxing.service.OrderJobService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;

@JobHandler(value = "orderReminderToServicerHandle")
@Component
public class OrderReminderToServicerHandle extends IJobHandler {
	private static final Logger logger = LoggerFactory.getLogger(OrderExpireHandler.class);

	@Resource
	private OrderJobService orderJobService;

	public OrderReminderToServicerHandle() {
        super();
    }

	@Override
	public void init() {
		super.init();
	}

	@Override
	public void destroy() {
		super.destroy();
	}

	@Override
	public ReturnT<String> execute(String param) throws Exception {
		ReturnT<String> returnT = ReturnT.SUCCESS;
		logger.info("==============给业务人员发送各种提醒定时任务start================");
		try {
			// 还款提醒告知
			orderJobService.orderRepayReminderToServicer();
		} catch (Exception e) {
			// TODO: handle exception
		}
		try {
			// 逾期后1天提醒并加入黑名单
			orderJobService.orderOverdueReminderToServicer();
		} catch (Exception e) {
			// TODO: handle exception
		}
		logger.info("==============给业务人员发送各种提醒定时任务end================");
		return returnT;
	}

}
